package com.tanhua.server.controller;


import com.tanhua.server.service.LoginLogsService;
import com.tanhua.server.vo.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("management/manage")
public class LoginLogController {
    @Autowired
    private LoginLogsService loginLogsService;


    @GetMapping("logs")
    public ResponseEntity<PageResult> queryLog(@RequestParam(value = "page",defaultValue = "1")Integer page,
                                               @RequestParam(value = "pagesize",defaultValue = "10")Integer pagesize,
                                               @RequestParam(value = "uid",required = true) Integer uid,
                                               @RequestParam(value = "sortProp",required = true)String sortProp,
                                               @RequestParam(value = "sortOrder",required = true)String sortOrder){

            PageResult pageResult = loginLogsService.queryLoginLogs(page,pagesize,uid,sortProp,sortOrder);

            return ResponseEntity.ok(pageResult);

    }
}
